package com.aios.entity.unit;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;

public enum GenderEnum {

	MALE(0, "male", "男"), FEMALE(1, "female", "女");

	private int index;
	private String genderEn;
	private String genderJp;

	private GenderEnum(int index, String genderEn, String genderJp) {
		this.index = index;
		this.genderEn = genderEn;
		this.genderJp = genderJp;
	}

	public String getGenderEn() {
		return genderEn;
	}

	public void setGenderEn(String genderEn) {
		this.genderEn = genderEn;
	}

	public String getGenderJp() {
		return genderJp;
	}

	public void setGenderJp(String genderJp) {
		this.genderJp = genderJp;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public static List<String> getList(Locale locale) {
		List<String> gender = new ArrayList<String>();

		for (GenderEnum ge : values()) {
			if (locale.equals(Locale.JAPAN) || locale.equals(Locale.JAPANESE)) {
				gender.add(ge.getGenderJp());
			} else {
				gender.add(ge.getGenderEn());
			}
		}

		return gender;
	}

	public static Map<Integer, String> getMap(Locale locale) {

		Map<Integer, String> map = new TreeMap<Integer, String>();

		for (GenderEnum ge : values()) {
			if (locale.equals(Locale.JAPAN) || locale.equals(Locale.JAPANESE)) {
				map.put(ge.index, ge.genderJp);
			} else {
				map.put(ge.index, ge.genderEn);
			}
		}

		return map;
	}
	
}
